//ดึงข้อมูล text editor มาใช้งาน
function getFormat_Onload(){
	CKEDITOR.replace( 'customers_txtaDescription',{
    	skin   : 'kama', //กำหนดรูปแบบหน้าตา
    	height   : 670, //กำหนดความสูง
    	width    : 795,//กำหนดความกว้าง
    	toolbar :
    	[
    	['Undo','Redo','-','Find','Replace','-'],
    	['Font','FontSize'],
    	['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    	['RemoveFormat'],
    	
    						'/',
    	['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    	['TextColor','BGColor'],
    	['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    						'/',
    	['Image','Flash','MediaEmbed','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
    	['Link','Unlink','Anchor'],
    	['Maximize', 'ShowBlocks','-','About']
    	],
    	filebrowserBrowseUrl : 'js/ckfinder/ckfinder.html',
    	filebrowserImageBrowseUrl : 'js/ckfinder/ckfinder.html?type=Images',
    	filebrowserFlashBrowseUrl : 'js/ckfinder/ckfinder.html?type=Flash',
    	filebrowserUploadUrl : 'js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    	filebrowserImageUploadUrl : 'js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    	filebrowserFlashUploadUrl : 'js/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
    });
}	
//เมื่อคลิกปุ่ม บันทึก จะเช็คค่าว่ามีอะไรบ้างที่ยังไม่ใส่
function customers_checkData(id)
{
	if(CKEDITOR.instances.customers_txtaDescription.getData() == "")
	{
		alert("กรุณากรอกรอกรายละเอียดเกี่ยวกับเรา");
		return false;
	}else{
		if(id != null)  	document.getElementById("customers_id").value = id;
		else document.getElementById("customers_id").value = "";			
		document.getElementById("customers_description").value = CKEDITOR.instances.customers_txtaDescription.getData().replace(/\'/g,"\\'");		
		document.forms["formSubmit"].submit();
	}
}
//ตัวอย่างเกี่ยวกับเรา
function customers_Preview()
{
	document.getElementById("customers_description").value = CKEDITOR.instances.customers_txtaDescription.getData().replace(/\'/g,"\\'");
	document.forms["formSubmit"].target = "_blank";
	document.forms["formSubmit"].action = "../customers_preview.php";
	document.forms["formSubmit"].submit();
}